﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BIS.Portal.Modules.CMS.DAL;
using BIS.Portal.Modules.CMS.Entity;

namespace BIS.Portal.Modules.CMS.BO
{
    public class AdminCmsCategoryBO
    {
        /// <summary>
        /// Gets the by language in use id.
        /// </summary>
        /// <param name="languageInUseId">The language in use id.</param>
        /// <returns></returns>
        public static IList<AdminCmsCategoryEntity> GetByLanguageInUseId(int languageInUseId)
        {
            return AdminCmsCategoryDAL.GetByLanguageInUseId(languageInUseId);
        }

        /// <summary>
        /// Gets the by language in use id.
        /// </summary>
        /// <param name="categoryId">The category id.</param>
        /// <returns></returns>
        public static AdminCmsCategoryEntity GetByCateId(int categoryId, int languageUserId)
        {
            return AdminCmsCategoryDAL.GetByCateId(categoryId, languageUserId);
        }

        /// <summary>
        /// Adds the category.
        /// </summary>
        /// <param name="cmsCateEntity">The CMS cate entity.</param>
        /// <returns></returns>
        public static bool AddCategory(AdminCmsCategoryEntity cmsCateEntity)
        {
            return (AdminCmsCategoryDAL.AddCategory(cmsCateEntity) > 0);
        }

        /// <summary>
        /// Updates the category.
        /// </summary>
        /// <param name="cmsCateEntity">The CMS cate entity.</param>
        /// <returns></returns>
        public static bool UpdateCategory(AdminCmsCategoryEntity cmsCateEntity)
        {
            return (AdminCmsCategoryDAL.UpdateCategory(cmsCateEntity) > 0);
        }

        /// <summary>
        /// Deletes the category.
        /// </summary>
        /// <param name="categoryId">The category id.</param>
        /// <returns></returns>
        public static bool DeleteCategory(int categoryId)
        {
            return (AdminCmsCategoryDAL.DeleteCategory(categoryId) > 0);
        }

        /// <summary>
        /// Determines whether this instance can category the specified category id.
        /// </summary>
        /// <param name="categoryId">The category id.</param>
        /// <param name="numOfchild">The num ofchild.</param>
        /// <returns>
        /// 	<c>true</c> if this instance can category the specified category id; otherwise, <c>false</c>.
        /// </returns>
        public static void CheckParentForDeleteCate(int categoryId, ref int numOfchild)
        {
            AdminCmsCategoryDAL.CheckParentForDeleteCate(categoryId, ref numOfchild);
        }

        /// <summary>
        /// Updates the status.
        /// </summary>
        /// <param name="categoryId">The category id.</param>
        /// <param name="showInMenu">The show in menu.</param>
        /// <param name="useDirectLink">The use direct link.</param>
        /// <param name="status">The status.</param>
        /// <returns></returns>
         public static bool UpdateStatus(int categoryId, int showInMenu, int useDirectLink, int status,string user,DateTime updateTime)
         {
             return AdminCmsCategoryDAL.UpdateStatus(categoryId, showInMenu, useDirectLink, status,user,updateTime) > 0;
         }
         /// <summary>
         ///  lấy category cho cate parent id
         /// </summary>
         /// <param name="iLanguage_in_use_id"></param>
         /// <returns></returns>
         public static IList<AdminCmsCategoryNameEntity> GetCategoryNameForParentCateId(int iLanguage_in_use_id)
         {
             return AdminCmsCategoryDAL.GetCategoryNameForParentCateId(iLanguage_in_use_id);
         }
    }
}
